def chooseGood():
  li=["手机","电脑","鼠标垫","游艇"]
  while 1:
    for i in li:
      print("{}\t\t{}".format(li.index(i)+1,i))
    buy=input("请输入要购买的商品序号,输入q或Q退出:\n")
    if buy.isdigit():
      if int(buy) in range(1,5):
        print("想要的是{1}:{0}".format(li[int(buy)-1],int(buy)))
      else:
        print("输入指定商品范围的数字序号!")
    elif buy.upper()=="Q":
      break
    else:
      print("输入数字序号或Q退出!") 
chooseGood()